<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>程序员盒子旗下推出轻博客系统-控制台</title>

    <link rel="shortcut icon" href="/favicon.ico" />
    <link rel="bookmark" href="/favicon.ico" />
    <link href="/css/common/common.css" rel="stylesheet" type="text/css" />
    <link href="/css/admin/console.css" rel="stylesheet" type="text/css"/>
    <link href="/ref/layui-v2.6.8/layui/css/layui.css" rel="stylesheet" type="text/css" />
    <script src="/ref/layui-v2.6.8/layui/layui.js" type="text/javascript"></script>
    <script src="/ref/jquery/jquery-3.4.1.js" type="text/javascript"></script>
    <script src="/js/client/auth.js" type="text/javascript"></script>
</head>

<body>
<center>
    <!-- 控制台头部 -->
    <div id="console-header">
        <a href="/admin/console" class="console-logo">WebChat 控制台</a>
        <img src="" id="login-user-avatar" style="position: absolute; right: 80px; top: 10px; height: 40px; width:
        40px; border-radius: 80px">
    </div>
    <!-- 控制台导航 -->
    <div id="console-left">
        <ul class="layui-nav layui-nav-tree layui-inline" style="margin-top: 20px; width: 240px;border: 0px;
        text-align: left" lay-filter="demo" id="menu-ul">
            <li class="layui-nav-item">
                <a href="/admin/user-manage" target="_body">用户管理</a>
            </li>
            <li class="layui-nav-item">
                <a href="/admin/mess-manage" target="_body">消息审核</a>
            </li>
        </ul>
    </div>
    <!-- 控制台主体 -->
    <iframe id="console-body" name="_body" src="/admin/default"></iframe>
</center>
</body>

<script>
    var userId;
    $.ajax({
        url:"/api/user/getCurrentAdminUserInfo",
        type:"get",
        success:function (data) {
            data = eval(data);
            if (data.success){
                data = data.data;
                userId = data.userId;
                $("#login-user-avatar").attr('src', data.photo);
            } else {
                layer.msg("未登录或者权限不足");
                location.href="/";
            }
        },error:function () {
            layer.msg("未登录或者权限不足");
            location.href="/";
        }
    })

    layui.use(['dropdown'], function() {
        var dropdown = layui.dropdown;
        //用户
        dropdown.render({
            elem: '#login-user-avatar'
            , data: [{
                title: '退出登录'
                , id: 1
            }]
            , click: function (obj) {
                if (obj.id == 1) {
                    loginOut();
                }
            }
        });
    })
</script>
</html>